08. Mapping Between Tables and Classes

Mapping Between Tables and Classes

ND004 C01 L03 08 Mapping Between Tables And Classes

QUIZ QUESTION: :

On the left is a SQL statement. See if you can match it with the corresponding class, object, or attribute.

ANSWER CHOICES:



SQL

SQLAlchemy class

class Tweets:
  def __init__(self, name):
    self.name = name
class Tweet:
  def __init__(self, content):
    self.content = content
tweet = { 'content': 'hey!' }
tweet = Tweet(content='hey!')
SOLUTION:

SQL

SQLAlchemy class

class Tweet:
  def __init__(self, content):
    self.content = content
tweet = Tweet(content='hey!')

ORM Match Quiz

QUIZ QUESTION: :

See if you can remember which of these things map to one another:

ANSWER CHOICES:



This…

…maps to this

objects

data

rows

dictionaries

attributes

classes

SOLUTION:

This…

…maps to this

objects

attributes

classes